/*
 * Copyright (c) 2018-2028 兰州安众信息科技有限公司 All Rights Reserved.
 * ProjectName: 甘肃九建OA系统
 */

package com.book.manager.base.result;

import io.swagger.annotations.ApiModel;

@ApiModel(value = "返回类")
public class Result<T> extends BaseResult {

    private static final long serialVersionUID = 4555197829603662221L;

    private Result() {
        super();
    }

    private Result(CodeMsg codeMsg, T data) {
        super(codeMsg,data);
    }

    private Result(String msg) {
        super(msg);
    }

    public static <T> Result<T> of(CodeMsg codeMsg, T data) {
        return new Result<T>(codeMsg, data);
    }

    public static Result of(String msg) {
        return new Result(msg);
    }

    public static BaseResult fail( ) {
        return of(CodeMsgEnum.FAILED);
    }
    public static Result fail(String msg) {
        return new Result(msg);
    }

    public static BaseResult success(){
        return of(CodeMsgEnum.SUCCESS);
    }

    public static <T>Result<T> success(T data){
        return of(CodeMsgEnum.SUCCESS,data);
    }
}

